package person.bing.fbcloud.mall.biz.controller;

import cn.hutool.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import person.bing.fbcloud.common.core.util.R;

import java.util.HashMap;

/**
 * @author: mengfanbing
 * @date: 2020/3/11 2:41
 */
@RestController
@RequestMapping("/route")
public class RouteController {
    public static final String GATEWAY_ROUTES = "geteway_routes";
    @Autowired
    private StringRedisTemplate redisTemplate;
    public R addRouteDefinition(JSONObject jsonObject){
        HashMap<String, Object> routeDefinition = new HashMap<>(jsonObject);
        redisTemplate.opsForHash().putAll(GATEWAY_ROUTES,routeDefinition);
        return new R();
    }


}
